package file;

import java.io.File;
import java.io.IOException;

public class fileTest {
    public static void main(String[] args) throws IOException {
        //构建file对象
        File f = new File( "F:/gitrepo/java_demo/demo2/src/file/fileTest.java");
        File f1 = new File("F:/gitrepo/java_demo/demo2/src/file");
        File f2 = new File(f1,"fileTest.java");
        File f22 = new File(new File("F:/gitrepo/java_demo/demo2/src/file"),"fileTest.java");

        //创建一个文件
        File f3 = new File(f1,"creatFile.jave");
        //f3.createNewFile();
        //删除一个文件
        f3.delete();
        //创建目录
        File f4 = new File("F:/gitrepo/java_demo/demo2/src/file/aa/bb/cc");
        f4.mkdirs();//如果cc的父目录不存在就用s,存在用mkdir
        File f5 = new File("F:/gitrepo/java_demo/demo2/src/file/aa/bb/cc/dd");
        f5.mkdir();
    }
}
